// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   ControlRegisterDTO.java

package com.hfstu.ifs.dto;

import com.hfstu.framework.util.StringUtil;
import com.hfstu.ifs.model.ControlGroup;
import com.hfstu.ifs.model.ControlRegister;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import org.apache.commons.beanutils.BeanUtils;

public class ControlRegisterDTO
	implements Serializable
{

	private String id;
	private String code;
	private String name;
	private String controlGroupId;
	private String controlGroupName;
	private String controlType;
	private String url;
	private String jsClassName;
	private String jsUrls;
	private String dtoType;

	public ControlRegisterDTO()
	{
		dtoType = "ControlRegisterDTO";
	}

	public String getId()
	{
		return id;
	}

	public void setId(String id)
	{
		this.id = id;
	}

	public String getCode()
	{
		return code;
	}

	public void setCode(String code)
	{
		this.code = code;
	}

	public String getName()
	{
		return name;
	}

	public void setName(String name)
	{
		this.name = name;
	}

	public String getControlGroupId()
	{
		return controlGroupId;
	}

	public void setControlGroupId(String controlGroupId)
	{
		this.controlGroupId = controlGroupId;
	}

	public String getControlGroupName()
	{
		return controlGroupName;
	}

	public void setControlGroupName(String controlGroupName)
	{
		this.controlGroupName = controlGroupName;
	}

	public String getControlType()
	{
		return controlType;
	}

	public void setControlType(String controlType)
	{
		this.controlType = controlType;
	}

	public String getUrl()
	{
		return url;
	}

	public void setUrl(String url)
	{
		this.url = url;
	}

	public String getJsClassName()
	{
		return jsClassName;
	}

	public void setJsClassName(String jsClassName)
	{
		this.jsClassName = jsClassName;
	}

	public String getJsUrls()
	{
		return jsUrls;
	}

	public void setJsUrls(String jsUrls)
	{
		this.jsUrls = jsUrls;
	}

	public String getDtoType()
	{
		return dtoType;
	}

	public void setDtoType(String dtoType)
	{
		this.dtoType = dtoType;
	}

	public ControlRegisterDTO transfer(ControlRegister controlRegister)
	{
		try
		{
			BeanUtils.copyProperties(this, controlRegister);
		}
		catch (IllegalAccessException e)
		{
			e.printStackTrace();
		}
		catch (InvocationTargetException e)
		{
			e.printStackTrace();
		}
		if (controlRegister.getControlGroup() != null)
		{
			setControlGroupId(controlRegister.getControlGroup().getId());
			setControlGroupName(controlRegister.getControlGroup().getName());
		}
		return this;
	}

	public String toJson()
	{
		StringBuilder json = new StringBuilder();
		json.append("{");
		json.append("\"id\":\"").append(getId()).append("\",");
		json.append("\"code\":\"").append(getCode()).append("\",");
		json.append("\"name\":\"").append(getName()).append("\",");
		json.append("\"controlType\":\"").append(StringUtil.clean(getControlType())).append("\",");
		json.append("\"url\":\"").append(StringUtil.clean(getUrl())).append("\",");
		json.append("\"jsClassName\":\"").append(StringUtil.clean(getJsClassName())).append("\",");
		json.append("\"jsUrls\":\"").append(StringUtil.clean(getJsUrls())).append("\",");
		json.append("\"dtoType\":\"").append(getDtoType()).append("\"");
		json.append("}");
		return json.toString();
	}
}
